package Reflect;

import java.lang.reflect.Field;

public class ReflectDemo8 {
    public static void main(String[] args) throws Exception {
        Class cla=Class.forName("Reflect.Teacher");
        Object obj=cla.newInstance();

        Field field=cla.getDeclaredField("name");
        field.set(obj,"张三");
        System.out.println(obj);

        Object value=field.get(obj);
        System.out.println(value);
//        System.out.println(field.get(obj));
    }
}
